package ideamaps.action;


import ideamaps.domain.User;
import ideamaps.manager.UserManager;

import com.taillive.commons.ConvertUtils;
import com.taillive.commons.TextUtils;
import com.taillive.core.dao.support.Page;
import com.taillive.core.web.StrutsAction;

public class FindAction extends StrutsAction{

	private UserManager userManager;
	public void setUserManager(UserManager userManager) {
		this.userManager = userManager;
	}
	
	private String q;
	public String getQ() {
		return q;
	}


	public void setQ(String q) {
		this.q = q;
	}
	
	private Page p;
	
	public Page getP() {
		return p;
	}


	public void setP(Page p) {
		this.p = p;
	}


	private int page;
	public int getPage() {
		return page;
	}


	public void setPage(int page) {
		this.page = page;
	}

	public String find() {
		p = userManager.getPage(ConvertUtils.trim(q), page, 5);
		p.setUrl("find.jspa");
		if(!TextUtils.isEmpty(q)) {
			p.addUrlParam("q",q);
		}
		return SUCCESS;
	}

}
